Learning Angular - Fourth Edition by Aristeidis Bampakos & Pablo Deeleman

Learning Angular - Fourth Edition by Aristeidis Bampakos & Pablo Deeleman

Author:Aristeidis Bampakos & Pablo Deeleman
Language: eng
Format: epub
Publisher: Packt
Published: 2023-02-15T00:00:00+00:00


Fetching data through HTTP

The product list component uses the products service to fetch and display product data. Data are currently hardcoded into the products property of the ProductsService class. In this section, we will modify our Angular application to work with live data from the Fake Store API:

Open the app.module.ts file and import the Angular module of the HTTP client: import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpClientModule } from '@angular/common/http'; import { AppComponent } from './app.component'; import { ProductsModule } from './products/products.module'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, HttpClientModule, ProductsModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.